using Verse;
using Verse.AI;

namespace RimWorld;

public class JobGiver_SelfTend : ThinkNode_JobGiver
{
	protected override Job TryGiveJob(Pawn pawn)
	{
		if (!pawn.RaceProps.Humanlike || !pawn.health.HasHediffsNeedingTend() || !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) || pawn.InAggroMentalState)
		{
			return null;
		}
		if (pawn.IsColonist && pawn.WorkTypeIsDisabled(WorkTypeDefOf.Doctor))
		{
			return null;
		}
		Job job = JobMaker.MakeJob(JobDefOf.TendPatient, pawn);
		job.endAfterTendedOnce = true;
		return job;
	}
}
